//待接单

import { get, post, remove, put } from '@/server/request'
import { baseApi, baseApp } from '@/server/base'

export const PendingApi = {
  /**
   * 进行 Orders动作
   * @returns
   */
  receiving(id: string | number) {
    return post(`${baseApi}/api/apk/tasks/accept/${id}`)
  },
  /**
   * 获取待接单信息
   * @param params
   * @returns
   */
  getList(params?: object) {
    return get(`${baseApi}/api/apk/tasks/pending`, params)
  },

  /**
   * 获取取消或转交的原因
   */
  getReason(params: { kpi: string; type: '申请取消' | '申请转交' }) {
    return get(`${baseApi}/api/apk/configs/reasons`, params)
  },

  /**
   * 取消申请 或 转单
   * @param params
   * @returns
   */
  postCancelOrTrans(params: PostCancelOrTrans) {
    return post(`${baseApi}/api/apk/tasks/cancel/${params.id}`, params)
  }
}

export type PostCancelOrTrans = {
  id: string | number
  state: 4 | 5 // 4 取消 5转交
  reason: string
  reason_other: string
}
